package com.herench.bs.support;

import org.springframework.util.StringUtils;

import java.io.Serializable;
import java.util.Date;

public class VerificationCodeLifeCycle implements Serializable {


    private static final long serialVersionUID = -1433043957174874623L;
    private String phone;   //手机号
    private Date expires; //有效期
    private String code;//验证码
    private boolean alive;//是否有效

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public Date getExpires() {
        return expires;
    }

    public void setExpires(Date expires) {
        this.expires = expires;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public boolean isAlive() {
        return alive;
    }

    public void setAlive(boolean alive) {
        this.alive = alive;
    }

    public boolean checkVerificationCode(String code){
        if (StringUtils.hasLength(code)){
            return this.code.equalsIgnoreCase(code);
        }else {
            return false;
        }
    }
}